package pranpro;

import java.io.File;
import java.io.FileNotFoundException;
import java.util.Scanner;
import java.util.logging.Level;
import java.util.logging.Logger;

/**
 *
 * @author einstein
 */
public class Projeto {

    /**lista de tarefas*/
    public Job job[];
    /**horizonte de tempo - confirmar!!*/
    public int horizon;
    /**data de entrega do projeto - confirmar!!*/
    public int dueDate;
    /**custo por atraso na entrega do projeto - confirmar!!*/
    public int tardCost;
    /**recursos renovaveis disponíveis*/
    public int available_R[];
    /**recursos não renovaveis disponíveis*/
    public int available_N[];
    /**recursos duplamente restritos disponíveis*/
    public int available_D[];
    /**perquisar o q é*/
    public int mpm_time;

    public boolean loadFromFile(String path) {
        try {
            File file = new File(path);
            Scanner scan;

            scan = new Scanner(file);

            String str = "";

            System.out.println(scan.nextLine());
            System.out.println(scan.nextLine());
            System.out.println(scan.nextLine());
            System.out.println(scan.nextLine());
            System.out.println(scan.nextLine());

            str = scan.nextLine();
            System.out.println(str);
            int x = Integer.parseInt(str.split(":")[1].trim());
            job = new Job[x];

            str = scan.nextLine();
            System.out.println(str);
            x = Integer.parseInt(str.split(":")[1].trim());
            horizon = x;

            System.out.println(scan.nextLine());

            str = scan.nextLine();
            System.out.println(str);
            str = str.split(":")[1].trim();
            x = Integer.parseInt(str.substring(0, str.length() - 1).trim());

            available_R = new int[x];

            str = scan.nextLine();
            System.out.println(str);
            str = str.split(":")[1].trim();
            x = Integer.parseInt(str.substring(0, str.length() - 1).trim());

            available_N = new int[x];

            str = scan.nextLine();
            System.out.println(str);
            str = str.split(":")[1].trim();
            x = Integer.parseInt(str.substring(0, str.length() - 1).trim());

            available_D = new int[x];

            System.out.println(scan.nextLine());
            System.out.println(scan.nextLine());
            System.out.println(scan.nextLine());

            scan.nextInt();
            scan.nextInt();
            scan.nextInt();

            dueDate = scan.nextInt();
            tardCost = scan.nextInt();
            mpm_time = scan.nextInt();

            System.out.println(scan.nextLine());
            System.out.println(scan.nextLine());
            System.out.println(scan.nextLine());

            for (int i = 0; i < job.length; i++) {
                System.out.println(scan.nextInt());
                x = scan.nextInt();
                job[i].mode = new Mode[x];
                x = scan.nextInt();
                job[i].suc = new Job[x];
            }


        } catch (Exception ex) {
            //Logger.getLogger(Projeto.class.getName()).log(Level.SEVERE, null, ex);
            return false;
        }
        return true;
    }
}
